// DevLessss Javascript Library.

/**
 * dvls Object Constructor
 * @id {string} Element ID.
 */
function dvls(id) {
	// About object is returned if there is no 'id' parameter
	var about = {
		Version: 0.5,
		Author: "DevLessss",
		Created: "2012",
		Info: "Which element is chosen? Element ID is not specified."
	};
	if (id) {
		// Avoid clobbering the window scope: 
		// return a new _ object if we're in the wrong scope
		if (window === this) {
			return new dvls(id);
		}
		// We're in the correct object scop:
		// Init our element object and return the object
		if (document.getElementById) {
			this.e = document.getElementById(id);
		} else if (document.all) {
			this.e = document.all(id);
		}
		return this;
	} else {
		// No 'id' paramter was given, return the 'about' object
		return about;
	}
};

/**
 * dvls Prototype Functions
 */
dvls.prototype = {
	hide: function () {
		this.e.style.display = 'none';
		return this;
	},
	show: function () {
		this.e.style.display = 'inherit';
		return this;
	},
	bgcolor: function (color) {
		this.e.style.background = color;
		return this;
	},
	val: function (newval) {
		this.e.value = newval;
		return this;
	},
	toggle: function () {
		if (this.e.style.display !== 'none') {
			this.e.style.display = 'none';
		} else {
			this.e.style.display = '';
		}
		return this;
	},
	size: function (height, width) {
		this.e.style.height = height + 'px';
		this.e.style.width = width + 'px';
		return this;
	}
};